// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-01

package withdrawal

import (
	"server/app/config"
	"server/app/errs"
	"server/app/kind"
)

type Request struct {
	Amount kind.Balance `validate:"required,min=5,max=500" label:"提现金额"`
}

func (o *Request) AfterValidate() (err error) {
	// 1. 小于最小.
	if o.Amount.Float() < config.WeiXin.GetWithdrawalMin() {
		err = errs.ErrWithdrawalLessThanMin
		return
	}

	// 2. 大于最大.
	if o.Amount.Float() > config.WeiXin.GetWithdrawalMax() {
		err = errs.ErrWithdrawalGreaterThanMax
	}
	return
}
